/*package com.vini.core.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.vini.core.ec.User;

@Repository
public class AuthenticationDaoImpl implements AuthenticationDao {
	
	@Autowired
	private SessionFactory sessionFactory;
	private Session session;

	@Override
	public User authenticate(String username, String password) {
		try{
			session = sessionFactory.openSession();
			String queryString = "SELECT user FROM User user where email_id=:email and password=:password";
			Query query = session.createQuery(queryString);
			query.setParameter("email", username);
			query.setParameter("password", password);
			List<User> users = query.list();
			return users.size()>0 ? users.get(0) : null ;
		}catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

}
*/